Skip to content

Fix UnixUserRecord shell field type from string to path#1260

Open
Peter-The-Great wants to merge 7 commits intofox-it:mainfrom
Peter-The-Great:fix/markusershellpath
Open

Fix UnixUserRecord shell field type from string to path#1260
Peter-The-Great wants to merge 7 commits intofox-it:mainfrom
Peter-The-Great:fix/markusershellpath

Conversation

@Peter-The-Great
Copy link
Contributor

@Peter-The-Great Peter-The-Great commented Jul 30, 2025

Made sure to change the field type of shell in UnixUserRecord from string to path. I also added a unit test, with a sanity check to make sure that the operation goes correctly as stated.

Closes #900.

Made sure to change the field type of shell in UnixUserRecord from string to path. I also added a unit test, with a sanity check to make sure that the operation goes correctly as stated.
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 30, 2025

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing Peter-The-Great:fix/markusershellpath (9768558) with main (f66d3dc)

Open in CodSpeed

Remove redundant UnixUserRecord shell type test and added a type assertion test to check if shell variable in user is a valid posix_path.
@Schamper Schamper linked an issue Aug 15, 2025 that may be closed by this pull request
@Schamper Schamper changed the title Fix UnixUserRecord shell field type from string to path. #900 Fix UnixUserRecord shell field type from string to path Aug 15, 2025
Copy link
Member

@Schamper Schamper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the failing unit tests?

@twiggler twiggler self-requested a review August 15, 2025 14:48
("string", "gecos"),
("path", "home"),
("string", "shell"),
("path", "shell"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the source field should also be a path?

@Peter-The-Great
Copy link
Contributor Author

Peter-The-Great commented Sep 2, 2025

Sure, I finally have the time.

Still working on it.

Peter-The-Great and others added 3 commits September 2, 2025 15:56
Ensure shell field is of type posix_path in UnixUserRecord and update tests accordingly. Apparently, in dissect, the test seemed to fail only on windows, so i made sure that the type is a posix_path, just like the home attribute. If anything needs to change, just let me know in the PR.
Remove breakpoint from user tests
@Schamper
Copy link
Member

@Peter-The-Great do you intend to continue working on this?

@Peter-The-Great
Copy link
Contributor Author

@Peter-The-Great do you intend to continue working on this?

Currently no, so if the PR is not necessary, you can close the pr or if someone else is going to implement it, assign it to someone else.

…ype error fox-it#1260

Ensure home/shell paths use explicit posix_path/windows_path types across OS plugins.

Changes:
- Path Typing: Enforced explicit posix_path/windows_path types for user home and shell fields across all OS plugins.
- Bug Fix: Resolved TypeError in Citrix plugin by normalizing unhashable path objects to strings for deduplication
- Consistency: Updated FortiOS and macOS plugins to use semantic path types instead of plain strings.
- Tests: Adjusted assertions to match explicit path flavors.
@Peter-The-Great
Copy link
Contributor Author

Peter-The-Great commented Mar 20, 2026

This seems to have fixed the test errors and a few other issues in the code, not sure if its alright if i kind of force the _as_hashable_path_or_str() onto Citrix to check if its a hashable path or not:

@staticmethod
    def _as_hashable_path_or_str(value: object | None) -> str | None:
        if value is None:
            return None
        if hasattr(value, "as_posix"):
            return value.as_posix()
        return str(value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mark user shell as a path

3 participants